package com.da.javatest.interview.session2;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author chenlida
 * @date 2020/3/28 23:32
 * @description CAS测试
 */
public class Test04 {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);

        System.out.println(atomicInteger.compareAndSet(5, 2020) + " current data:" + atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5, 1024) + " current data:" + atomicInteger.get());
    }
}
